package com.financing.wap.dao.impl;


import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.financing.wap.dto.PrItemDTO;
import com.financing.wap.dao.IPrItemDao;
import com.financing.wap.common.SqlName;
/**
 * pr_item  
 * 项目表 数据访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("prItemDao")
public class PrItemDaoImpl extends BaseDaoImpl<PrItemDTO, Integer> implements IPrItemDao {


	@Override
	public int insert(PrItemDTO prItem) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.insert(SqlName.PrItemSql.insert, prItem);
	}

	@Override
	public void update(PrItemDTO prItem) throws SQLException {
		this.sqlMapClientTemplate.update(SqlName.PrItemSql.update, prItem);
	}

	@Override
	public void updateForce(PrItemDTO prItem) throws SQLException {
		this.sqlMapClientTemplate.update(SqlName.PrItemSql.updateForce, prItem);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		this.sqlMapClientTemplate.delete(SqlName.PrItemSql.delete,id);
	}
	
	@SuppressWarnings("unchecked")	
	@Override
	public List<PrItemDTO> queryList(PrItemDTO prItem) throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.PrItemSql.queryList, prItem);
	}

	@Override
	public int queryListCount(PrItemDTO prItem) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.PrItemSql.queryListCount, prItem);
	}

	@Override
	public PrItemDTO loadById(Integer id) throws SQLException {
		return  (PrItemDTO)this.getSqlMapClientTemplate().queryForObject(SqlName.PrItemSql.loadById,id);
	}

	@Override
	public Map queryStatistics(String openId) throws SQLException {
		return  (Map)this.getSqlMapClientTemplate().queryForObject("prItem.queryStatistics",openId);
	}

	@Override
	public List<PrItemDTO> queryStatisticsList(String openId) {
		return this.sqlMapClientTemplate.queryForList("prItem.queryStatisticsList", openId);
	}

	@Override
	public Class<PrItemDTO> getEntityClass() {
		return PrItemDTO.class;
	}
 	
}
